package util.entityhelper;

import entity.ChosenMetricEntity;
import java.util.Comparator;

public class PositionComparator implements Comparator {

    @Override
    public int compare(Object obj1, Object obj2) {
        ChosenMetricEntity metric1 = (ChosenMetricEntity) obj1;
        ChosenMetricEntity metric2 = (ChosenMetricEntity) obj2;
        
        int column = metric1.getColumnPosition()-metric2.getColumnPosition();
        if ( column != 0)
            return column;
        
        return metric1.getListPosition() - metric2.getListPosition();
    }
}
